package io.renren.modules.shop.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.shop.entity.GoodsPayInfoEntity;
import io.renren.modules.shop.service.GoodsPayInfoService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 支付表
 *
 * @author admin
 * @email admin@gmail.com
 * @date 2019-04-03 01:03:53
 */
@RestController
@RequestMapping("shop/goodspayinfo")
public class GoodsPayInfoController {
    @Autowired
    private GoodsPayInfoService goodsPayInfoService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("shop:goodspayinfo:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = goodsPayInfoService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("shop:goodspayinfo:info")
    public R info(@PathVariable("id") Integer id){
		GoodsPayInfoEntity goodsPayInfo = goodsPayInfoService.getById(id);

        return R.ok().put("goodsPayInfo", goodsPayInfo);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("shop:goodspayinfo:save")
    public R save(@RequestBody GoodsPayInfoEntity goodsPayInfo){
		goodsPayInfoService.save(goodsPayInfo);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("shop:goodspayinfo:update")
    public R update(@RequestBody GoodsPayInfoEntity goodsPayInfo){
		goodsPayInfoService.updateById(goodsPayInfo);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("shop:goodspayinfo:delete")
    public R delete(@RequestBody Integer[] ids){
		goodsPayInfoService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
